/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    ArrayList<Integer> arrayList;
    boolean ss ;
    public boolean findTarget(TreeNode root, int k) {
        arrayList = new ArrayList<>();
        ss = false;
        dfc(root,k);
        return ss;
    }
    public void dfc(TreeNode root, int k) {
        if(root == null) {
            return;
        }
        dfc(root.left,k);
        if(!ss) {
            ss = arrayList.contains(k - root.val);
        }
        arrayList.add(root.val);
        dfc(root.right,k);
    }
}